package com.mz.ozy.mvp.model;

import android.content.Context;

import com.mz.ozy.constants.Constants;
import com.mz.ozy.net.RetrofitUtils;
import com.mz.ozy.utils.JsonUtils;
import com.mz.ozy.utils.MD5Util;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.ResponseBody;

/**
 * Created by administrator on 2018/12/3.
 */
public class ExchangeModel {


    public Observable<ResponseBody> getExchangeInfo(Context context) {
        Map<String, String> maps = new HashMap<>();

        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10011, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }
    public Observable<ResponseBody> getXgExchangeInfo(Context context) {
        Map<String, String> maps = new HashMap<>();
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10022, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }

    public Observable<ResponseBody> onExchange(Context context, String amount, String coin, String password) {
        Map<String, String> maps = new HashMap<>();
        maps.put("amt", amount);
        maps.put("coinCode", coin);
        maps.put("pwd", MD5Util.getMD5String(password));
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10028, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }

    public Observable<ResponseBody> onExchange(Context context, String amount, String password) {
        Map<String, String> maps = new HashMap<>();
        maps.put("amt", amount);
        maps.put("pwd", MD5Util.getMD5String(password));
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10012, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }
    public Observable<ResponseBody> onXxqExchange(Context context, String amount, String password) {
        Map<String, String> maps = new HashMap<>();
        maps.put("amt", amount);
        maps.put("pwd", MD5Util.getMD5String(password));
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10023, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }
    public Observable<ResponseBody> onKtExchange(Context context, String type, String amount, String password) {
        Map<String, String> maps = new HashMap<>();
        maps.put("amt", amount);
        maps.put("type", type);
        maps.put("pwd", MD5Util.getMD5String(password));
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10014, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }

    public Observable<ResponseBody> onKtExchange(Context context, String type) {
        Map<String, String> maps = new HashMap<>();
        maps.put("type", type);

        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10013, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }

}
